package org.geoserver.jtilecache.tile;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.geoserver.jtilecache.mime.ImageMimeType;

public class ImageFormat {

	private static Log log = LogFactory.getLog(org.geoserver.jtilecache.tile.ImageFormat.class);

	private int height;
	private int width;
	private ImageMimeType mime;


	public ImageFormat() {
	}

	public ImageFormat(ImageMimeType mime, int height, int width) {
		this.mime = mime;
		this.height = height;
		this.width = width;
	}

	public ImageFormat(String mime, String height, String width) {
		try {
			this.mime = new ImageMimeType(mime);
		} catch (IOException ioe) {
			log.error("Could not create ImageFormat: ", ioe);
		}
		this.height = Integer.valueOf(height).intValue();
		this.width = Integer.valueOf(width).intValue();
	}

	/**
	 * @return the height
	 */
	public int getHeight() {
		return height;
	}
	/**
	 * @param height the height to set
	 */
	public void setHeight(int height) {
		this.height = height;
	}
	/**
	 * @return the mime
	 */
	public ImageMimeType getMime() {
		return mime;
	}
	/**
	 * @param mime the mime to set
	 */
	public void setMime(ImageMimeType mime) {
		this.mime = mime;
	}
	/**
	 * @return the width
	 */
	public int getWidth() {
		return width;
	}
	/**
	 * @param width the width to set
	 */
	public void setWidth(int width) {
		this.width = width;
	}

}
